import { request } from '@/utils/request'
import { ApiType } from './types'
import { PageQueryFormType, QueryFormType } from '@/types/queryform'
import { PromiseResponse, PromiseResponsePage } from '@/types/type'

/* eslint-disable no-unused-vars */
enum API {
    GET_APIS_URL = '/api/getAll',
    GET_APIS_PAGE_URL = '/api/getPage',
    SYNC_APIS_URL = '/api/syncApi',
}

/**
 * 获取所有
 * @param queryForm 查询表单
 * @returns 所有接口数据
 */
export const getAllApis = (queryForm?: QueryFormType<any>): PromiseResponse<ApiType[]> => request(API.GET_APIS_URL, 'GET', {}, queryForm)
/**
 * 分页获取
 * @param queryForm 分页查询表单
 * @returns 分页接口数据
 */
export const getPageApis = (queryForm?: PageQueryFormType<any>): PromiseResponsePage<ApiType> => request(API.GET_APIS_PAGE_URL, 'GET', {}, queryForm)
/**
 * 同步Api接口
 * @returns
 */
export const syncApi = (): PromiseResponse<boolean> => request(API.SYNC_APIS_URL, 'POST')
